<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/tools/unitJS.js"></script>
</head>
<body>
	
	<div id="warp">
		<div id="content">
			为保障“看厦门”APP稳定的运行，对内容制播提供高效、快捷、优质的服务，对故障进行前瞻性检查及维护，中标供应商现场维保工作时间应与新媒体中心实际工作时间相对应，每日8小时正常上班，8小时外（含晚间、节假日）应安排人员值班应对突发情况，正常工作时间至少确保有两人在岗。
非日常工作时间、周末及节假日，至少1人在厦门市内待班，24小时手机保持畅通，接到通知后1小时到达现场。
如遇到临时的宣传推广、互动性活动或突发事件情况，为保障“看厦门”APP稳定运行，台方要求运维人员到场加班协助台方人员做好系统运行的安全保障工作。
现场运维人员及为本项目配备的非现场开发人员应保质保量按期完成软件升级服务内容规定的系统测试及BUG修复、系统优化、迭代升级、客户端功能升级、系统调整等工作。
		</div>
		<div id="scrollWarp">
			<div id="line">
				
			</div>
		</div>
	</div>

</body>

<script type="text/javascript">

	var scrollNum = 0;
	
	var content = document.getElementById('content');

	var scrollWarp = document.getElementById('scrollWarp');

	var line = document.getElementById('line');

	var Browser = UnitJS.myBrowser();

	if (Browser == 'FF') {
		content.addEventListener('DOMMouseScroll', wheel, false);
	}else {
		content.onmousewheel = wheel;
	}

	function wheel(e){
		var ev = e || event;
		var down = true;
		if (ev.detail) {
			down = ev.detail > 0;
		}else {
			down = ev.wheelDelta < 0;
		}



		if (down) {
			scrollNum -= 30;
			if (scrollNum <= warp.offsetHeight - content.offsetHeight) {
				scrollNum  = warp.offsetHeight - content.offsetHeight;
			}
		}else {
			scrollNum += 30;
			if (scrollNum >= 0) {
				scrollNum  = 0;
			}
		}
		move();

		if (ev.preventDefault) {
			ev.preventDefault();
		}
		return false;
	}

	line.onmousedown = function(e){

		var ev = e || event;

		var linePostion = UnitJS.getPostion(scrollWarp);


		line.onmousemove = function(e){

			var ev = e || event;

			var x = ev.clientX;
			var y = ev.clientY;

			var top = y - linePostion.top - line.offsetHeight / 2;

			if (top <= 0) {
				top = 0;
			}

			if (top >= scrollWarp.offsetHeight - line.offsetHeight) {
				top = scrollWarp.offsetHeight - line.offsetHeight;
			}

			var contentSingin = top / (scrollWarp.offsetHeight - line.offsetHeight);
			line.style.top = top + 'px';
			scrollNum = -(content.offsetHeight - warp.offsetHeight) * contentSingin;
			content.style.top = scrollNum + 'px';
		}

		document.onmouseup = function(e){
			line.onmousemove = null;
		}

		ev.canclebubble = true;
		return false;
	}


	document.onkeydown = function(e){
		var ev = e || event;
		switch (ev.keyCode) {
			case 37:
				// 左
				break;
			case 38:
				// 上
				scrollNum += 30;
				if (scrollNum >= 0) {
					scrollNum  = 0;
				}
				move();

				break;
			case 39:
				// 右
				break;
			case 40:
				// 下
				scrollNum -= 30;
				if (scrollNum <= warp.offsetHeight - content.offsetHeight) {
					scrollNum  = warp.offsetHeight - content.offsetHeight;
				}
				move();
				
				break;
			default:
				break;
		}
	}


	scrollWarp.onmousedown = function(e){
		var ev = e || event;
		var top = ev.clientY - warp.offsetTop - line.offsetHeight / 2;

		if (top <= 0) {
			top = 0;
		}
		
		if (top >= scrollWarp.offsetHeight - line.offsetHeight) {
			top = scrollWarp.offsetHeight - line.offsetHeight;
		}

		var contentSingin = top / (scrollWarp.offsetHeight - line.offsetHeight);
		line.style.top = top + 'px';
		scrollNum = -(content.offsetHeight - warp.offsetHeight) * contentSingin;
		content.style.top = scrollNum + 'px';
	}


	function move(){
			content.style.top = scrollNum + 'px';
			var lineSingin = scrollNum / (content.offsetHeight - warp.offsetHeight);
			line.style.top = -(scrollWarp.offsetHeight - line.offsetHeight) * lineSingin + 'px';
	}

</script>

</html>







